﻿using System;
using System.Web.UI;


namespace mojoPortal.Web.RS.SBM
{
    public partial class RSManageWorkOrder : RSBasePage
    {
        int _companyid = 0;
        int _workorderid = 0;
        int _locationid = 0;
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["workorderid"] != null)
                _workorderid = Convert.ToInt32(Request.QueryString["workorderid"].ToString());
            if (Request.QueryString["locationid"] != null)
                _locationid = Convert.ToInt32(Request.QueryString["locationid"].ToString());

            if (!Page.IsPostBack)
            {
                InitializeReadyServicePage();

                RSUserIdentity userIdentity = GetRSUserIdentity();
                _companyid = userIdentity.RSCompanyId;

                if (_companyid > 0)
                {
                    if (Request.QueryString["action"] == "add")
                        SetRSPageHeader("Add Work Order");
                    else
                        SetRSPageHeader("Edit Work Order");
                    ucLocationHeaderControl.LoadLocationHeader(_companyid, _locationid);
                    bool hasData = ucWorkOrderControl.LoadWorkOrderDataByID(_companyid, _workorderid);
                }
            }
        }

    }
}